import 'package:flutter/material.dart';
import 'package:flutter_enjoy_plus/page/home/index.dart';
import 'package:flutter_enjoy_plus/page/mine/index.dart';

class TabsPage extends StatefulWidget {
  const TabsPage({super.key});

  @override
  State<TabsPage> createState() => _TabsPageState();
}

class _TabsPageState extends State<TabsPage> {
  int _currentIndex = 0;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: IndexedStack(
        index: _currentIndex,
        children: const [
          HomePage(),
          MinePage(),
        ],
      ),
      bottomNavigationBar: BottomNavigationBar(
          type: BottomNavigationBarType.fixed,
          selectedItemColor: const Color(0xff5592af),
          unselectedItemColor: const Color(0xff434242),
          selectedFontSize: 12,
          unselectedFontSize: 12,
          currentIndex: _currentIndex,
          onTap: (index) {
            setState(() {
              _currentIndex = index;
            });
          },
          items: [
            BottomNavigationBarItem(
              icon: Image.asset(
                'assets/tabs/home_default.png',
                width: 24,
                height: 24,
              ),
              activeIcon: Image.asset(
                'assets/tabs/home_active.png',
                width: 24,
                height: 24,
              ),
              label: '首页',
            ),
            BottomNavigationBarItem(
                icon: Image.asset(
                  'assets/tabs/my_default.png',
                  width: 24,
                  height: 24,
                ),
                activeIcon: Image.asset(
                  'assets/tabs/my_active.png',
                  width: 24,
                  height: 24,
                ),
                label: '我的'),
          ]),
    );
  }
}
